home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr26 / blrmu13.zip / CRSR.ASM < prev    next >
Assembly Source File  |  1993-06-01  |  8KB  |  314 lines

  1. page ,132
  2. title crsr ( cursor - set off or on ) - as of 10/09/91 - 12:35 pm
  3. ;
  4. ;   this program either turns off the cursor
  5. ;   ( after saving the first and last line values )
  6. ;   ( in the space occupied by an empty interrupt address, )
  7. ;   ( such as user interrupts ( UI ) 60h thru 66h )
  8. ;
  9. ;   or turns it back on
  10. ;   ( using the first and last line values previously stored ) -
  11. ;
  12. ;   this program will check UI 60h thru 66h for you,
  13. ;   and if it finds one of them empty,
  14. ;   then it will act on the passed parameter -
  15. ;
  16. ;   if all of these UI's are being used, then this program will put out a
  17. ;   message stating such, and terminate -
  18. ;
  19. ;   crsr syntax :
  20. ;
  21. ;   crsr       ( default = turn cursor off )
  22. ;   crsr off   ( turns cursor off )
  23. ;   crsr on    ( turns cursor on  )
  24. ;
  25. ;*---------------------------
  26. csroff   macro
  27. ;*---------------------------
  28. ;*   cursor off
  29. ;*---------------------------
  30. ;
  31.          push  ax
  32.          push  cx
  33.          mov   ah,1
  34.          mov   ch,32
  35.          int   10h
  36.          pop   cx
  37.          pop   ax
  38.          endm
  39. ;
  40. ;*---------------------------
  41. csron    macro
  42. ;*---------------------------
  43. ;*   cursor on
  44. ;*---------------------------
  45.          push  ax
  46.          push  cx
  47.          mov   ah,1
  48.          mov   ch,stcsl                ; restore the crsr start line
  49.          mov   cl,stcel                ; restore the crsr end line
  50.          int   10h
  51.          pop   cx
  52.          pop   ax
  53.          endm
  54. ;
  55. ;*---------------------------
  56. csrsv    macro
  57. ;*---------------------------
  58. ;*   cursor save
  59. ;*---------------------------
  60.          push  ax
  61.          push  bx
  62.          push  cx
  63.          mov   ah,3
  64.          mov   bh,0
  65.          int   10h
  66.          mov   stcsl,ch                ; save the crsr start line
  67.          mov   stcel,cl                ; save the crsr end line
  68.          pop   cx
  69.          pop   bx
  70.          pop   ax
  71.          endm
  72. ;
  73. ;*-------------------------------------
  74. ;*   direct console input
  75. ;*-------------------------------------
  76. dci      macro cic
  77.          mov   ah,7
  78.          int   21h
  79.          mov   cic,al
  80.          endm
  81. ;
  82. ;*------------------------------------
  83. lm       macro msg
  84. ;*------------------------------------
  85. ;*  list message
  86. ;*------------------------------------
  87.          lea   ax,msg
  88.          call  lmts
  89.          endm
  90. ;
  91. ;*--------------------------
  92. ;*   macro pool end
  93. ;*--------------------------
  94. ;
  95.          .model small
  96.          .code
  97. ;
  98. ;  equate(s)
  99. ;
  100. eva      equ   60h                     ; empty vector address
  101. ;
  102. ;   parm area
  103. ;
  104.          org   128
  105. ;
  106. pl       db    0                       ; parm len ( includes space )
  107.          db    0                       ; space
  108. o        db    0                       ; 'o'
  109. nof      db    0                       ; 'n' or 'f'
  110. ;
  111. ;  starting address of com program
  112. ;
  113.          org   256
  114. ;
  115. crsr:
  116.          jmp   go
  117. ;
  118. ;   data section
  119. ;
  120.          align 2
  121. ;
  122. voo      dw    0                       ; vector original offset
  123. vos      dw    0                       ; vector original segment
  124. ;
  125. doeva    label word                    ; dummy offset
  126. stcsl    db    0                       ; save the crsr start line
  127. stcel    db    0                       ; save the crsr end line
  128. ;
  129. uva      db    0                       ; used vector address
  130. evaf     db    0                       ; eva flag
  131. spp      db    0                       ; save passed parameter
  132. spl      db    0                       ; save parm len
  133. ;
  134. nevm     db    13,10,10
  135.          db    ' * no empty vectors in the group 60h thru 66h - sorry ! '
  136.          db    13,10,10
  137.          db    ' * press any key for termination ! '
  138.          db    13,10,10,0
  139. ;
  140. rr       db    0                       ; reg reply
  141. ;
  142. ;  code section
  143. ;
  144. go:
  145. ;
  146.          mov   al,nof                  ; save
  147.          mov   spp,al                  ; passed parm
  148. ;
  149.          mov   al,pl                   ; save
  150.          mov   spl,al                  ; parm len
  151. ;
  152.          mov   uva,eva                 ; set used vector address
  153. ;
  154.          call  chkeva                  ; call check empty vector address
  155. ;
  156.          cmp   evaf,0                  ; is one of the UI's empty ? )
  157.          je    ccl                     ; if so, chk cmd line
  158.          jmp   nev                     ; else, give up
  159. ;
  160. ;   check command line
  161. ;
  162. ccl:
  163.          cmp   spl,0                   ; parm len = 0 ?
  164.          je    joff                    ; if so, default
  165. ;
  166. ;  check passed parameters
  167. ;
  168.          cmp   spp,'f'                 ; off ?
  169.          je    joff
  170.          cmp   spp,'n'                 ; on ?
  171.          je    jon
  172.          jmp   joff                    ; if neither, take default
  173. ;
  174. ;   jumps
  175. ;
  176. joff:     jmp   crsroff
  177. jon:      jmp   crsron
  178. ;
  179. ;   check empty vector
  180. ;
  181. chkeva   proc  near
  182. ;
  183.          mov   evaf,0                  ; clear flag
  184. chkeval:
  185.          mov   ah,35h
  186.          mov   al,uva                  ; used vector address
  187.          int   21h
  188.          mov   vos,es                  ; get segment
  189. ;
  190.          cmp   vos,0                   ; empty ?
  191.          jne   chkevan                 ; if not, try next entry
  192.          ret                           ; else, ok exit
  193. ;
  194. ;   next
  195. ;
  196. chkevan:
  197.          add   uva,1                   ; bump to next
  198.          cmp   uva,66h                 ; end ?
  199.          ja    chkevaee                ; if above, error exit
  200.          jmp   chkeval                 ; try again
  201. ;
  202. ;   chkeva err exit
  203. ;
  204. chkevaee:
  205.          mov   evaf,1                  ; set flag
  206.          ret                           ; err exit
  207. ;
  208. chkeva   endp
  209. ;
  210. ;   no empty vectors
  211. ;
  212. nev:
  213.          lm    nevm                    ; display msg
  214.          dci   rr                      ; wait for keypress
  215.          jmp   getout                  ; exit program
  216. ;
  217. ;   cursor off entrance
  218. ;
  219. crsroff:
  220. ;
  221. ;   save cursor lines and turn off cursor
  222. ;
  223.          csrsv                         ; crsr save
  224.          csroff                        ; crsr off
  225. ;
  226. ;   save cursor lines in proper int address
  227. ;
  228.          mov   ah,25h
  229.          mov   al,uva                  ; used vector address
  230.          mov   dx,doeva                ; ptr to stcsl and stcel
  231.          push  ds                      ; save ds
  232.          mov   bx,0                    ; clear
  233.          mov   ds,bx                   ; ds
  234.          int   21h
  235.          pop   ds                      ; restore ds
  236. ;
  237.          jmp   getout                  ; exit
  238. ;
  239. ;   cursor on entrance
  240. ;
  241. crsron:
  242. ;
  243.          mov   ah,35h
  244.          mov   al,uva                  ; used vector address
  245.          int   21h
  246.          cmp   bx,0
  247.          jne   gsas
  248.          mov   bx,0706h                ; end line - start line
  249. gsas:
  250.          mov   doeva,bx                ; get stcsl and stcel
  251. ;
  252.          csron                         ; crsr on
  253. ;
  254. ;   reset vector address ( reset proper int address to 0 )
  255. ;
  256.          mov   ah,25h
  257.          mov   al,uva                  ; used vector address
  258.          mov   dx,0                    ; clear dx
  259.          push  ds                      ; save ds
  260.          mov   bx,0                    ; clear
  261.          mov   ds,bx                   ; ds
  262.          int   21h
  263.          pop   ds                      ; restore ds
  264. ;
  265. ;    exit
  266. ;
  267. getout:
  268.          mov   al,0                    ; set cond code to 0
  269.          mov   ah,76                   ; exit
  270.          int   33
  271. ;
  272. ;*------------------------------
  273. ;*     lmts.prc
  274. ;*------------------------------
  275. ;
  276. ;*------------------------------
  277. ;*   list msg to screen
  278. ;*------------------------------
  279. ;
  280. ;*------------------------------
  281. ;*   called by macro lm
  282. ;*   using ax as ptr to msg
  283. ;*------------------------------
  284. ;*  msg terminated by final zero
  285. ;*  or max 512 bytes
  286. ;*------------------------------
  287. lmts     proc  near
  288.          push  ax
  289.          push  bx
  290.          push  cx
  291.          push  si
  292.          mov   bx,ax
  293.          mov   cx,512
  294.          mov   si,0
  295. lmtsl:
  296.          mov   al,[bx][si]
  297.          cmp   al,0
  298.          je    lmtsx
  299.          int   41
  300.          inc   si
  301.          loop  lmtsl
  302. lmtsx:
  303.          pop   si
  304.          pop   cx
  305.          pop   bx
  306.          pop   ax
  307.          ret
  308. lmts     endp
  309. ;*-----------------------
  310. ;*  end of lmts.prc
  311. ;*-----------------------
  312. ;
  313.          end   crsr
  314.